package com.finalist.util;

import java.util.HashMap;
import java.util.Map;

public class SmsContentUtils {
	
	private final static String TPL_1 = "【乐语集团】您正在通过风客旅行进行手机号码预定,请进行身份验证,验证码${code},切勿将验证码泄漏给他人,如非本人操作,请勿理会此条短信。";
	private final static String TPL_2 = "【乐语集团】您正在通过风客旅行进行无注册购物,请进行身份验证,验证码${code},切勿将验证码泄漏给他人,如非本人操作,请勿理会此条短信。";
	private final static String TPL_3 = "【乐语集团】订单提交成功,可以根据用户名：${userName}或者手机号：${phone}登陆,密码为${password},查询订单信息,如非本人操作,请勿理会此条短信。";
	private final static String TPL_4 = "【乐语集团】您已经预约成功,您的预约凭证为：${identityCode}，预约到的手机号为：${phone},请您到北京西直门店办理,如非本人操作,请勿理会此条短信。";
	
	
	public static String getSmsCodeContent(String code) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("code", code);
		try {
			return FreemarkerUtils.process(TPL_1, map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return null;
	}
	
	public static String getSmsCodeContentOfNotLogin(String code) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("code", code);
		try {
			return FreemarkerUtils.process(TPL_2, map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return null;
	}
	
	public static String getSmsCodeContentOfNotLogin(String userName, String phone, String password) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("userName", userName);
		map.put("phone", phone);
		map.put("password", password);
		try {
			return FreemarkerUtils.process(TPL_3, map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return null;
	}
	
	public static String getSmsCodeContentOfIdentityCode(String identityCode, String phone) {
		Map<String, String> map = new HashMap<String, String>();
		map.put("identityCode", identityCode);
		map.put("phone", phone);
		try {
			return FreemarkerUtils.process(TPL_4, map);
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return null;
	}
	
	public static void main(String[] args) {
		System.out.println("TPL===" + getSmsCodeContent("123556"));
	}

}
